parantArray = [1,-2,3,-8,5,1]

theLength = len(parantArray)

theMax = -999
# 表示寻找子数组的长度，1到len-1
for i in range(1,theLength):
    for j in range(theLength-1):
        if i+j <= theLength-1:
            currentArray = parantArray[j:i+j+1]
            if sum(currentArray)>theMax:
                theMax = sum(currentArray)

print(theMax)